package com.summo.demo.config.manager;

import java.util.Set;

import com.summo.demo.config.cache.CacheService;
import com.summo.demo.util.BaseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class UserManager {

    @Autowired
    private CacheService cacheService;

    public Set<String> queryAuthByUserId(Long userId) {
        return BaseUtil.selectCacheByTemplate(
            () -> this.cacheService.queryAuthByUserIdByRedis(userId),
            () -> this.cacheService.queryAuthByUserIdFromDB(userId));
    }
}
